sprintf-related integer and memory overflow issues
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 4 Sep 2011 21:52:59 +0000 (14:52 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 4 Sep 2011 21:52:59 +0000 (14:52 -0700)
1  2 
ChangeLog
lib-src/ChangeLog
nt/ChangeLog

diff --cc ChangeLog
index 1f38dbf71ca4b9becc35838ff47fbdc9031f750e,c973a82e8a47003bed9cc57885c3fc7c7d85bce8..aae3e190049ab05912dc39dec5c02da918032e49
+++ b/ChangeLog
@@@ -1,3 -1,7 +1,7 @@@
 -2011-08-31  Paul Eggert  <eggert@cs.ucla.edu>
++2011-09-04  Paul Eggert  <eggert@cs.ucla.edu>
+       * configure.in (snprintf): New check.
  2011-08-30  Paul Eggert  <eggert@cs.ucla.edu>
  
        * configure.in (opsys): Change pattern to *-*-linux*
index 3a0c63f8eb4b696ba6a9e06ab2a42b3ecfbd6ad3,11d30a7143402913105886f13b870142eaaf1f0a..836af349960fa656063f463f69d3bdd561b591ef
@@@ -1,3 -1,38 +1,38 @@@
 -2011-08-28  Paul Eggert  <eggert@cs.ucla.edu>
++2011-09-04  Paul Eggert  <eggert@cs.ucla.edu>
+       Integer and memory overflow issues (Bug#9397).
+       * emacsclient.c (xmalloc): Accept size_t, not unsigned int, to
+       avoid potential buffer overflow issues on typical 64-bit hosts.
+       Return void *, not long *.
+       (get_current_dir_name): Report a failure, instead of looping
+       forever, if buffer size calculation overflows.  Treat malloc
+       failures like realloc failures, as that has better behavior and is
+       more consistent.  Do not check whether xmalloc returns NULL, as
+       that's not possible.
+       (message): Do not arbitrarily truncate message to 2048 bytes when
+       sending it to stderr; use vfprintf instead.
+       (get_server_config, set_local_socket)
+       (start_daemon_and_retry_set_socket): Do not alloca
+       arbitrarily-large buffers; that's not safe.
+       (get_server_config, set_local_socket): Do not use sprintf when its
+       result might not fit in 'int'.
+       (set_local_socket): Do not assume uid fits in 'int'.
+       * etags.c (xmalloc, xrealloc): Accept size_t, not unsigned int,
+       to avoid potential buffer overflow issues on typical 64-bit hosts.
+       (whatlen_max): New static var.
+       (main): Avoid buffer overflow if subsidiary command length is
+       greater than BUFSIZ or 2*BUFSIZ + 20. Do not use sprintf when its
+       result might not fit in 'int'.
+       * movemail.c (main): Do not use sprintf when its result might not fit
+       in 'int'.  Instead, put the possibly-long file name into the
+       output of pfatal_with_name.
+       * update-game-score.c: Include <limits.h>
+       (get_user_id): Do not assume uid fits in 'int'.  Simplify.
  2011-07-28  Paul Eggert  <eggert@cs.ucla.edu>
  
        Assume freestanding C89 headers, string.h, stdlib.h.
diff --cc nt/ChangeLog
index 299f97bebec109730e1bde58b7c77faa79bd4149,ae9bfbb608193c808b0325bb6a47a5f9f4579c0b..d7d8c9b595b64bd78f25657e992e7479eb050f42
@@@ -1,3 -1,7 +1,7 @@@
 -2011-08-31  Paul Eggert  <eggert@cs.ucla.edu>
++2011-09-04  Paul Eggert  <eggert@cs.ucla.edu>
+       * config.nt (HAVE_SNPRINTF): New macro.
  2011-07-28  Paul Eggert  <eggert@cs.ucla.edu>
  
        Assume freestanding C89 headers, string.h, stdlib.h.